<?php
require_once( '../../../inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );

$utente=(int)$_COOKIE['memberID'];
$id=$_POST['user'];
$messaggio=$_POST['messaggio'];
$ultimoid=$_POST['ultimoid'];
//$messaggio=str_replace("'", "`", $messaggio);
$pagina=$_POST['pagina'];

if ($id==$utente) {

$db = mysql_connect(DATABASE_HOST,DATABASE_USER,DATABASE_PASS);
mysql_query("SET NAMES 'utf8'");

//il nickname del sender
$aInfomember1=getProfileInfo($invia);
$miosender=$aInfomember1['NickName'];

//il nickname del recipient
$aInfomember2=getProfileInfo($riceve);
$miorecipient=$aInfomember2['NickName'];


	
$array["sender_p_link"] = BX_DOL_URL_ROOT.$miosender;
$array["sender_p_nick"] = $miosender;
$array["recipient_p_link"] = BX_DOL_URL_ROOT.$miorecipient;
$array["recipient_p_nick"] = $miorecipient;
$array["messaggioo"] = $messaggio;
$str = serialize($array);	

if ($db == FALSE)
 die ("errore di connessione");
 mysql_select_db(DATABASE_NAME,$db) or die ("errore selezione database");
 $query  = "INSERT INTO bx_spy_data (sender_id,recipient_id,lang_key,params,type) VALUES ('$id','$id','_bx_spywall_message','$str','profiles_activity')";
 $result = mysql_query($query);
 
//Dichiarazione variabili
echo '
<script type="text/javascript" src="modules/ibdw/spywall/js/jmini.js"/></script>
<script>
    $jqspywall = jQuery.noConflict();
</script>';
 include BX_DIRECTORY_PATH_MODULES.'ibdw/spywall/config.php';
include 'templatesw.php';
$varpage = strpos($pagina, '?');
if ($varpage==FALSE) { $pagina=$pagina.'?'; } else { $pagina=$pagina; };
$userid = (int)$_COOKIE['memberID'];
$mioid = getID($_REQUEST['ID']);
$cont=$limite+1;
$parami=0;
$paramf=$limite;
$varlink = strpos($pagina, 'member.php');
$varlinkhome = strpos($pagina, 'index.php');
include 'masterquery.php';
$result = mysql_query($query,$db) or die(mysql_error());
$contazioni = mysql_num_rows($result);
$titolocommenti = _t('_ibdw_spywall_comment_title');
$titolocommenti_2 = _t('_ibdw_spywall_comment_title_first');
$idn = 0;
echo '<div id="correzione">';
echo '<div id="updateajax" style="display:none;"> </div>';
include 'basecore.php';
include 'controllo.php';
if ($contazioni>$limite) 
{   
 echo '<div id="altrenews"> </div>';
 $paginaajax=str_replace("?", "", $pagina);
 $paginaajax=str_replace("/", "", $paginaajax);
 echo '<div id="altro">';
 echo '<a href="javascript:altrenews('.$contanews.','.$limite.',\' '.$pagina.' \','.$mioid.','.$GLOBAL['ultimoid'].');" class="primoaltre"><b>'._t('_ibdw_spywall_altrenews').'</b></a>';  
 echo '</div>';
}
}
?>